#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QImage>
#include <QPainter>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QImage destImage(":/images/disk.png");
    QImage sourceImage(":/images/magnetNeedle.png");
    QPainter painter;
    painter.begin(&destImage);
    //painter.setCompositionMode(QPainter::CompositionMode_DestinationOver);
    //painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
    painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
    painter.drawImage(sourceImage.rect(), sourceImage);
    painter.end();
    //destImage.save("sourceOver.png");
    //destImage.save("destOver.png");
    //destImage.save("sourceIn.png");
    destImage.save("destIn.png");


}

MainWindow::~MainWindow()
{
    delete ui;
}
